<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>admin</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f8f9fa;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: auto;
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .cmd {
            cursor: pointer;
            padding: 10px;
            margin: 5px 0;
            background-color: #e9ecef;
            border: 1px solid #dee2e6;
            border-radius: 4px;
        }
        .cmd:hover {
            background-color: #dcdcdc;
        }
        @media (max-width: 768px) {
            .cmd {
                font-size: 1.2rem; /* 在小屏幕上增大字体 */
                padding: 20px; /* 增大内边距 */
            }
        }
    </style>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<div class="container">
    {% if password_correct %}
    <ul>
        {% for cmd in cmd_list %}
        <li class="cmd">{{ cmd }}</li>
        {% endfor %}
    </ul>
    {% load static %}
    <!--suppress HtmlUnknownTarget -->
    <script src="{% static 'js/comm.js' %}"></script>
    <script>
        $(document).ready(function () {
            $('.cmd').click(function () {
                $.post(
                    replace_url(window.location.href, '/admin/air_conditioner'),
                    {
                        'cmd': $(this).text(),
                    },
                    function (res) {
                        alert(res);
                    }
                )
            });
        });
    </script>
    {% else %}
    <p>无权访问</p>
    {% endif %}
</div>
</body>
</html>